package sy8_2;

import java.util.Iterator;
import java.util.TreeSet;

public class demo1 {
    public static void main(String[] args) {
        TreeSet<Person> set= new TreeSet<>();
        Person[] persons = new Person[]{
                new Person("zhangsan","10001"),
                new Person("zhangsan","10002"),
                new Person("lisi","10001"),
                new Person("wangwu","10004"),
                new Person("wangliu","10000")
        };
        for (int i = 0; i < persons.length; i++) {
            set.add(persons[i]);
        }
        Iterator<Person> iterator = set.iterator();
        while (iterator.hasNext()){
            Person person = iterator.next();
            System.out.println(person);
        }
    }
}
